var _hmt = _hmt || [];
(function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?22c1515a2aa57c4f0dd5a3d513d6df7d";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();


$.extend({
    bodySize:function(windowSize){
        var wSize=windowSize||1000;
        $(window).resize(function(){
            if($(window).width()<wSize){
                $('html').css({'font-size':$(window).width()/(wSize/2)*20});
            }else{
                $('html').removeAttr('style');
            }
        });
        if($(window).width()<wSize){
            $('html').css({'font-size':$(window).width()/(wSize/2)*20});
        }
    }
});
$(window).ready(function(){
    $.bodySize(750);
    var mySwiper = new Swiper('.swiper-container', {
        initialSlide: 0,
        loop:true,
        //direction: 'vertical',
        autoplay:true,
        preventLinksPropagation: false,//滑动阻止点击事件
        navigation: {
            nextEl: '.nextbtn',
            prevEl: '.prevbtn'
        },
        pagination: {
            el: '.swiper-pagination'
        }
    });
    var speed=20;
    var tab=document.getElementById("tab");
    var tab1=document.getElementById("tab1");
    var tab2=document.getElementById("tab2");
    var tab3=document.getElementById("tab3");
    var tab4=document.getElementById("tab4");
    var tab5=document.getElementById("tab5");
    tab2.innerHTML=tab1.innerHTML;
    tab5.innerHTML=tab4.innerHTML;
    function Marquee(){
        if(tab2.offsetHeight-tab.scrollTop<=0)
            tab.scrollTop-=tab1.offsetHeight;
        else{
            tab.scrollTop++;
        }
    }
    function Marquee2(){
        if(tab5.offsetHeight-tab3.scrollTop<=0)
            tab3.scrollTop-=tab4.offsetHeight;
        else{
            tab3.scrollTop++;
        }
    }
    var MyMar=setInterval(Marquee,speed);
    tab.onmouseover=function() {clearInterval(MyMar)};
    tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};

    var MyMar1=setInterval(Marquee2,speed);
    tab3.onmouseover=function() {clearInterval(MyMar1)};
    tab3.onmouseout=function() {MyMar1=setInterval(Marquee2,speed)};


});
var url = window.location.href;
$.ajax({
    url: '/wechat/signature?url=' + url,
    type: 'get',
    data: {},
    success:function(res){
        console.log(res);
        // wx.config({
        //     debug: false,
        //     appId: 'wxf6ab07b40eb8ba3f',
        //     timestamp: res.timestamp,
        //     nonceStr: res.nonceStr,
        //     signature: res.signature,
        //     jsApiList: [
        //         'checkJsApi',
        //         'onMenuShareTimeline',
        //         'onMenuShareAppMessage',
        //         'onMenuShareQQ'
        //     ]
        // });
        wx.ready(function () {
            var shareData = {
                title: document.title,
                desc: getDesc(),
                link: res.url,
                imgUrl: getImage()
            };
            wx.onMenuShareAppMessage(shareData);
            wx.onMenuShareTimeline(shareData);
            wx.onMenuShareQQ(shareData);
        });
        wx.error(function (res) {
            alert(res.errMsg);  // 正式环境记得关闭啊！！！！
        });
    }
});


